﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UIT.Controls;
using System.Xml;
using UIT.Markup;
using UIT.Web.Renderers.Specials;

namespace UIT.Web.Renderers
{
    class TextBlockRenderer : WebControlRenderer<TextBlock>
    {
        public override void Render(TextBlock control)
        {
            writer.WriteStartElement("span");
            control.RenderFullStyle(writer);
            Binding binding = control.GetBinding("Text");
            if (binding != null)
            {
                if (RunAt == Controls.Template.RunAtMode.Client)
                    binding.Render(writer);

                else
                    writer.WriteString(Convert.ToString(binding.GetValue()));
            }
            else
                writer.WriteString(control.Text);
            writer.WriteEndElement();
        }
    }
}
